doctype html
html(lang='en')
  head
    meta(charset="utf-8")
    meta(name="viewport", content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no")
    title Mongoose v#{package.version}: #{title}
    include ./includes/favicon.jade
    block style

      link(rel="stylesheet", href="https://unpkg.com/purecss@1.0.0/build/pure-min.css", integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w", crossorigin="anonymous")

      link(rel="stylesheet", href="https://fonts.googleapis.com/css?family=Open+Sans")
      link(rel="stylesheet", href="/docs/css/github.css")
      link(rel="stylesheet", href="/docs/css/mongoose5.css")

      link(rel='apple-touch-icon', sizes='57x57', href='images/favicon/apple-icon-57x57.png')
      link(rel='apple-touch-icon', sizes='60x60', href='images/favicon/apple-icon-60x60.png')
      link(rel='apple-touch-icon', sizes='72x72', href='images/favicon/apple-icon-72x72.png')
      link(rel='apple-touch-icon', sizes='76x76', href='images/favicon/apple-icon-76x76.png')
      link(rel='apple-touch-icon', sizes='114x114', href='images/favicon/apple-icon-114x114.png')
      link(rel='apple-touch-icon', sizes='120x120', href='images/favicon/apple-icon-120x120.png')
      link(rel='apple-touch-icon', sizes='144x144', href='images/favicon/apple-icon-144x144.png')
      link(rel='apple-touch-icon', sizes='152x152', href='images/favicon/apple-icon-152x152.png')
      link(rel='apple-touch-icon', sizes='180x180', href='images/favicon/apple-icon-180x180.png')
      link(rel='icon', type='image/png', sizes='192x192',  href='images/favicon/android-icon-192x192.png')
      link(rel='icon', type='image/png', sizes='32x32', href='images/favicon/favicon-32x32.png')
      link(rel='icon', type='image/png', sizes='96x96', href='images/favicon/favicon-96x96.png')
      link(rel='icon', type='image/png', sizes='16x16', href='images/favicon/favicon-16x16.png')
      link(rel='manifest', href='images/favicon/manifest.json')
      meta(name='msapplication-TileColor', content='#ffffff')
      meta(name='msapplication-TileImage', content='images/favicon/ms-icon-144x144.png')
      meta(name='theme-color', content='#ffffff')

  body
    #layout
      #mobile-menu
        a#menuLink.menu-link(href='#menu')
          span
        #mobile-logo-container
          a(href="/")
            img#logo(src="/docs/images/mongoose5_62x30_transparent.png")
            span.logo-text mongoose
      #menu
        .pure-menu
          #logo-container.pure-menu-heading
            a(href="/")
              img#logo(src="/docs/images/mongoose5_62x30_transparent.png")
              span.logo-text mongoose
          ul.pure-menu-list
            li.pure-menu-horizontal.pure-menu-item.pure-menu-has-children.pure-menu-allow-hover.version
              a(href="#").pure-menu-link Version #{package.version}
              ul.pure-menu-children
                li.pure-menu-item
                  a.pure-menu-link(href="/docs/4.x") Version #{package.latest4x}
                li.pure-menu-item
                  a.pure-menu-link(href="/docs/3.8.x") Version #{package.latest38x}
            li.pure-menu-item
              a.pure-menu-link(href="/docs/index.html") Quick Start
            li.pure-menu-item
              a.pure-menu-link(href="/docs/guide.html") Schemas
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/schematypes.html") SchemaTypes
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/connections.html") Connections
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/models.html") Models
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/documents.html") Documents
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/subdocs.html") Subdocuments
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/queries.html") Queries
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/validation.html") Validation
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/middleware.html") Middleware
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/populate.html") Populate
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/discriminators.html") Discriminators
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/plugins.html") Plugins
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/lambda.html") AWS Lambda
            li.pure-menu-item
              a.pure-menu-link(href="/docs/api.html") API
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/api.html#Schema") Schema
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/api.html#Connection") Connection
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/api.html#Document") Document
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/api.html#Model") Model
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/api.html#Query") Query
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/api.html#Aggregate") Aggregate
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/api.html#Schematype") SchemaType
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/api.html#Virtualtype") VirtualType
            li.pure-menu-item.sub-item
              a.pure-menu-link(href="/docs/api.html#Error") Error
            li.pure-menu-item
              a.pure-menu-link(href="/docs/compatibility.html") Version Compatibility
            li.pure-menu-item
              a.pure-menu-link(href="/docs/faq.html") FAQ
            li.carbon-ad
              <script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=mongoosejscom" id="_carbonads_js"></script>
      .container
        #content
          block content
      include includes/keen

      script(type="text/javascript").
        (function (window, document) {
          var layout   = document.getElementById('layout'),
              menu     = document.getElementById('menu'),
              menuLink = document.getElementById('menuLink'),
              content  = document.getElementById('content');

          function toggleClass(element, className) {
              var classes = element.className.split(/\s+/),
                  length = classes.length,
                  i = 0;

              for(; i < length; i++) {
                if (classes[i] === className) {
                  classes.splice(i, 1);
                  break;
                }
              }
              // The className is not found
              if (length === classes.length) {
                  classes.push(className);
              }

              element.className = classes.join(' ');
          }

          function toggleAll(e) {
              var active = 'active';

              e.preventDefault();
              toggleClass(layout, active);
              toggleClass(menu, active);
              toggleClass(menuLink, active);
          }

          menuLink.onclick = function (e) {
              toggleAll(e);
          };

          content.onclick = function(e) {
              if (menu.className.indexOf('active') !== -1) {
                  toggleAll(e);
              }
          };

        }(this, this.document));
